﻿<UserControl x:Class="WpfRcp.Modules.Panels.Views.Controls.ToolbarView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:Regions="clr-namespace:Microsoft.Practices.Composite.Presentation.Regions;assembly=Microsoft.Practices.Composite.Presentation"
             >
    <UserControl.Resources>
            <Style x:Key="toolbarBorder" TargetType="{x:Type Border}">
                <Setter Property="CornerRadius" Value="3" />
                <Setter Property="Margin" Value="2" />
                <Setter Property="Background" Value="{DynamicResource LeftToolbarBackground}" />
            </Style>

        <Style x:Key="radioButtonListBox" TargetType="ListBox">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBox">
                        <ItemsPresenter />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="toolbarRadioButtonStyle" TargetType="ToggleButton">
            <Setter Property="Focusable" Value="False" />
            <Setter Property="Foreground" Value="White" />
            <Setter Property="FontSize" Value="10" />
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ToggleButton">
                        <Border x:Name="border" Background="#EE424242" CornerRadius="3" Margin="1">
                            <Grid>
                                <Rectangle Width="32" Height="32" Fill="{TemplateBinding Background}" />
                                <ContentPresenter Margin="{TemplateBinding Control.Padding}" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" RecognizesAccessKey="True" Content="{TemplateBinding ContentControl.Content}" />
                            </Grid>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="border" Property="Background" Value="#EE424242" />
                                <Setter TargetName="border" Property="Opacity" Value="0.5" />
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="border" Property="Background" Value="#707070" />
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter TargetName="border" Property="Background" Value="#AAAAAA" />
                            </Trigger>
                            <Trigger Property="IsChecked" Value="True">
                                <Setter TargetName="border" Property="Background" Value="#AAAAAA" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="listBoxItemStyle" TargetType="ListBoxItem" >
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBoxItem">
                        <RadioButton Content="{TemplateBinding ContentPresenter.Content}" Background="{TemplateBinding Background}" IsChecked="{Binding Path=IsSelected, RelativeSource={x:Static RelativeSource.TemplatedParent}, Mode=TwoWay}" Style="{StaticResource toolbarRadioButtonStyle}" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="pointerListBoxItemStyle" TargetType="ListBoxItem" BasedOn="{StaticResource listBoxItemStyle}">
            <Setter Property="Background">
                <Setter.Value>
                    <ImageBrush ImageSource="../../Resources/Images/pointer.png" />
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background">
                        <Setter.Value>
                            <ImageBrush ImageSource="../../Resources/Images/pointer_h.png" />
                        </Setter.Value>
                    </Setter>
                </Trigger>
                <Trigger Property="IsSelected" Value="True">
                    <Setter Property="Background">
                        <Setter.Value>
                            <ImageBrush ImageSource="../../Resources/Images/pointer_h.png" />
                        </Setter.Value>
                    </Setter>
                </Trigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="loopListBoxItemStyle" TargetType="ListBoxItem" BasedOn="{StaticResource listBoxItemStyle}">
            <Setter Property="Background">
                <Setter.Value>
                    <ImageBrush ImageSource="../../Resources/Images/loop.png" />
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background">
                        <Setter.Value>
                            <ImageBrush ImageSource="../../Resources/Images/loop_h.png" />
                        </Setter.Value>
                    </Setter>
                </Trigger>
                <Trigger Property="IsSelected" Value="True">
                    <Setter Property="Background">
                        <Setter.Value>
                            <ImageBrush ImageSource="../../Resources/Images/loop_h.png" />
                        </Setter.Value>
                    </Setter>
                </Trigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="handListBoxItemStyle" TargetType="ListBoxItem" BasedOn="{StaticResource listBoxItemStyle}">
            <Setter Property="Background">
                <Setter.Value>
                    <ImageBrush ImageSource="../../Resources/Images/hand.png" />
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background">
                        <Setter.Value>
                            <ImageBrush ImageSource="../../Resources/Images/hand_h.png" />
                        </Setter.Value>
                    </Setter>
                </Trigger>
                <Trigger Property="IsSelected" Value="True">
                    <Setter Property="Background">
                        <Setter.Value>
                            <ImageBrush ImageSource="../../Resources/Images/hand_h.png" />
                        </Setter.Value>
                    </Setter>
                </Trigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="toolbarButtonStyle" TargetType="ButtonBase" >
            <Setter Property="Focusable" Value="False" />
            <Setter Property="Foreground" Value="White" />
            <Setter Property="FontSize" Value="10" />
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ButtonBase">
                        <Border x:Name="border" Background="#EE424242" CornerRadius="3" Margin="1">
                            <Grid>
                                <Rectangle Width="32" Height="32" Fill="{TemplateBinding Background}" />
                                <ContentPresenter Margin="{TemplateBinding Control.Padding}" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" RecognizesAccessKey="True" Content="{TemplateBinding ContentControl.Content}" />
                            </Grid>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="border" Property="Background" Value="#EE424242" />
                                <Setter TargetName="border" Property="Opacity" Value="0.5" />
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="border" Property="Background" Value="#707070" />
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter TargetName="border" Property="Background" Value="#AAAAAA" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="treeLayoutToolbarButtonStyle" TargetType="Button" BasedOn="{StaticResource toolbarButtonStyle}">
            <Setter Property="Background">
                <Setter.Value>
                    <ImageBrush ImageSource="../../Resources/Images/tree.png" />
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="graphLayoutToolbarButtonStyle" TargetType="Button" BasedOn="{StaticResource toolbarButtonStyle}">
            <Setter Property="Background">
                <Setter.Value>
                    <ImageBrush ImageSource="../../Resources/Images/graph.png" />
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>

    <StackPanel>
        <Border Style="{StaticResource toolbarBorder}">
            <ListBox Style="{StaticResource radioButtonListBox}" IsEnabled="true"
                     Margin="2" Background="Transparent" BorderThickness="0" >
                <ListBoxItem Style="{StaticResource pointerListBoxItemStyle}" />
                <ListBoxItem Style="{StaticResource handListBoxItemStyle}" />
                <ListBoxItem Style="{StaticResource loopListBoxItemStyle}" />
            </ListBox>
        </Border>

        <Border Style="{StaticResource toolbarBorder}">
            <StackPanel Margin="2">
                <Button Style="{StaticResource treeLayoutToolbarButtonStyle}" Command="{Binding OpenAndDisplayFileCommand}"/>
                <Button Style="{StaticResource graphLayoutToolbarButtonStyle}" Command="{Binding WaitCommand}"/>
            </StackPanel>
        </Border>

    </StackPanel>

</UserControl>
